home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-23 | 3.9 KB | 102 lines | [TEXT/GEOL] |
- Item 9444121 20-March-90 09:18PST
-
- From: CDA0470 DEV PhySy Music & Development,IDV
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: MA FileFiltering
-
- Hello all!
-
- Enclosed is some code that I am working on. What I am having problems with is
- toggling between different file types in an SFOpen Dialog. I have no problems
- with the setting of the buttons or the initial setting of the FileFilter, its
- just updating the FileFilter that is causing some problems. This is code that I
- am bringing over from a non-MA program, where it worked fine. Even now I can
- hear the disk turning, like it is creating a new file list, it's just that
- nothing shows up. I can't quite figure it out. Any help would be appreciated.
-
- Phil Smy
- PMD
- CDA0470
-
- {*******************}
- procedure TESQ1Application.SFGetParms (itscmdNumber: CmdNumber; var dlgID:
- integer; var where: Point; var fileFilter, dlgHook, filterProc: ProcPtr;
- typeList: HTypeList);
- OVERRIDE;
- begin
- inherited SFGetParms(itscmdNumber, dlgID, where, fileFilter, dlgHook,
- filterProc, typeList); {}
- {let MacApp set default values }
- if (itscmdNumber = cNew) or (itscmdNumber = cOpen) then
- begin
- SetHandleSize(Handle(typeList), 4); { allow only ‘Bank’ files }
- typeList^^[1] := 'Bank';
- gWhichOne := kESQORgPlus;
- dlgID := kOpenDialogID; { use custom dialog resource }
- dlgHook := @MySFHook; { splice in our own dlgHook to handle custom}
- {dialog controls }
- fileFilter := @SFFileFilter; { do extra file filtering }
- end
- end;
-
- function SFFileFilter (p: parmBlkPtr): boolean;
- begin {SFFileFilter}
- SFFileFilter := TRUE; {Don't show it -- default}
- case gWhichOne of
- kESQOrgOld: {My Old}
- if p^.ioFlFndrInfo.fdType = 'ESQ1' then
- SFFileFilter := FALSE; {Show it}
- kSoundFile: {Blank/Beaverton (saved as Bank only)}
- if p^.ioFlFndrInfo.fdType = 'EBNK' then
- SFFileFilter := FALSE;
- kESQORgPlus: {My New}
- if p^.ioFlFndrInfo.fdType = 'Bank' then
- SFFileFilter := FALSE; {Show it}
- otherwise
- ;
- end;
- end; {SFFileFilter}
-
- function MySFHook (MySFitem: integer; theDialog: DialogPtr): integer;
- const
- ESQOrgOldButton = 11;
- SoundFileButton = 12;
- ESQOrgPlusbutton = 13;
- firstTime = -1; {the first time our hook is called, it is}
- { passed a -1}
-
- reDrawList = 101; {returning 101 as item number will cause the}
- { file list to be recalculated}
- btnOn = 1; {control value for on}
- btnOff = 0; {control value for off}
-
- var
- itemToChange: Handle; {needed for GetDItem and SetCtlValue}
- itemBox: Rect; {needed for GetDItem}
- itemType: integer; {needed for GetDItem}
- buttonTitle: Str255; {needed for GetIndString}
-
- begin {MySFHook}
- case MySFitem of
-
- firstTime:
- begin { before the dialog is drawn, our hook gets called }
- { with a -1 (firstTime) as the item so we can change }
- { things like button titles, etc. }
- {Set buttons to correct state}
- MySFHook := MySFitem; {pass back the same item we were sent}
- end; {firstTime}
- ESQOrgOldButton:
- begin
- if gWhichOne <> 1 then
- begin
- {Set buttons}
- gWhichOne := kESQOrgOld;
- MySFHook := reDrawList; {we must tell SF to redraw the list}
- end;
- end; {ESQOrgOldButton}
-
-
-